import java.util.Arrays;

public class BubbleSort {
    public static void bubbleSort(int[] array){
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j] > array[j+1]){
                    int tmp = array[j];
                    array[j] = array[j+1];
                    array[j+1] = tmp;
                }
            }
        }
    }

    public static void main(String[] args) {
        int[] array1 = {1, 3, 5, 2, 10, 8, 6};
        bubbleSort(array1);
        System.out.println(Arrays.toString(array1));
    }
}
